package com.ccb.sc.common.modules.shopkeeper.enums;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

/**
 * @author ken
 * @since 2020-09-15
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@Getter
public enum ShopkeeperPointsLogType implements IEnum<Integer> {

    /**
     * 变动类型 0直播订单转换 1直接下级订单转换 2间接下级订单转换 3提现扣除 4提现退回
     */
    EXCHANGE_ORDER(0, "直播订单转换"),

    DIRECT_SUBORDINATE_EXCHANGE_ORDER(1, "直接下级订单转换"),

    INDIRECT_SUBORDINATE_EXCHANGE_ORDER(2, "间接下级订单转换"),

    WITHDRAW(3, "提现扣除"),

    WITHDRAW_RETURN(4, "提现退回"),

    AD(5, "广告奖励"),

    MALL(6, "商城购买扣除"),

    MALL_BACK(7, "商城退还"),

    MALL_REWARD(8, "商城下单奖励"),

    INVITE(9, "邀请奖励"),

    INVITE_GROUPON(10, "邀请团购奖励"),

    LUXURY_RECYCLE(11, "奢侈品回收"),

    GROUPON(12, "团购下单"),

    GROUPON_BACK(13, "团购未成团退还"),


    SYSTEM_AWARD(30, "系统奖励"),
    SYSTEM_DEDUCT(31, "系统扣除"),
    ;

    private int value;
    private String desc;

    ShopkeeperPointsLogType(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public static ShopkeeperPointsLogType getByValue(int value) {
        for (ShopkeeperPointsLogType logType : ShopkeeperPointsLogType.values()) {
            if (logType.getValue() == value) {
                return logType;
            }
        }
        return null;
    }
}
